package com.iwhalecloud.citybrain.flow.platform.manager.domain.repository;

import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.databind.JsonNode;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.notice.FlowReTimeoutSettingVo;

/**
 * @author lilh
 * @date 2019-07-11 16:27
 */
public interface FlowReTimeoutSettingRepository {

    /**
     * 新增
     *
     * @param entity 实体
     * @return 记录数
     */
    int insertFlowReTimeoutSetting(FlowReTimeoutSettingVo entity);

    /**
     * 列表
     */
    List<FlowReTimeoutSettingVo> listFlowReTimeoutSetting(String deploymentId, String nodeCode);

    /**
     * 当流到某个任务节点时，复制flow_re_timeout_setting表中的数据到flow_ru_timeout_setting表中
     *
     * @param deployId   部署ID
     * @param procInstId 实例ID
     * @param activityId 任务节点ID
     * @param taskId     任务ID
     * @return
     */
    void copyReTimeoutSetting(String deployId, String procInstId, String activityId, String taskId);

    /**
     * 保存任务办理通知，解析JSON并保存为结构化数据
     *
     * @param deployId
     * @param activityId
     * @param candidateUsers
     * @param noticeChannel
     * @return
     */
    Integer saveActivityNoticeChannel(String deployId, String activityId, JsonNode candidateUsers, JsonNode noticeChannel);

    /**
     * 保存超时和预警通知设置，解析JSON并保存为结构化数据
     *
     * @param deployId
     * @param activityId
     * @param timeoutSetting
     * @return
     */
    Integer saveTimeoutNoticeSetting(String deployId, String activityId, JsonNode timeoutSetting, Map<String,JsonNode> taskUsers);

    /**
     * @param deploymentId
     * @param nodeCode
     * @param types
     * @return
     */
    List<FlowReTimeoutSettingVo> listFlowReTimeoutSetting(String deploymentId, String nodeCode, List<String> types);

}
